package com.ruyuan.scholartrade.controller;

import com.scholar.shop.common.CommonRes;
import com.scholar.shop.trad.coupon.api.CouponAPI;
import com.scholar.shop.trad.coupon.domain.CouponVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 优惠券client实现
 *
 * @author zh
 * @version v7.0
 * @date 18/12/6 下午4:28
 * @since v7.0
 */
@CrossOrigin
@RestController
@Slf4j
@RequestMapping("/trade/coupon/open/api")
public class CouponAPIController  {


    @Autowired
    private CouponAPI couponAPI;
    @PostMapping("/editCouponShopName")
    public CommonRes<Boolean> editCouponShopName(@RequestParam Integer shopId, @RequestParam String shopName) {
            return couponAPI.editCouponShopName(shopId, shopName) ;
    }

    
    @GetMapping("/{id}")
    public CommonRes<CouponVO> getModel(@PathVariable Integer id) {
       return couponAPI.getModel(id) ;
    }

    
    @PostMapping("/addReceivedNum/{couponId}")
    public CommonRes<Boolean> addReceivedNum(@PathVariable Integer couponId) {
       return couponAPI.addReceivedNum(couponId);
    }
}
